package com.fcscs.cservice.common;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import com.fcscs.core.common.MainEnums.HasDisplayString;

public interface CServiceCommonEnums {

	public static enum Type implements HasDisplayString {
		HOME("Home", PmsType.HOME),
		BUSINESS("Business", PmsType.BUSINESS),
		;
		String dispString;
		PmsType pmsType;

		Type(String dispString, PmsType pmsType) {
			this.dispString = dispString;
			this.pmsType = pmsType;
		}

		@Override
		public String getDisplayStr() {
			return dispString;
		}

		public PmsType getPmsType() {
			return pmsType;
		}
	}
	
	public static enum InRoomMenuType implements HasDisplayString{
		CATEGORY("Category", 1),
		SUBCATEGORY("Subcat", 2),
		ITEM("Item", 3),
		SUGGEST_ITEM("SuggestItem", 4)
		;
		String dispString;
		int level;

		InRoomMenuType(String dispString, int level) {
			this.dispString = dispString;
			this.level = level;
		}
		
		public int getLevel() {
			return level;
		}

		@Override
		public String getDisplayStr() {
			// TODO Auto-generated method stub
			return null;
		}
		
	}
	
	
	public static enum InRoomCategoryLevel {
		
		CATEGORY(1),
		SUBCATEGORY(2),
		;
		int level;

		InRoomCategoryLevel(int level) {
			this.level = level;
		}
		
		public int getLevel() {
			return this.level;
		}
		
		public static Set<Integer> levels() {
			Set<Integer> levels = new TreeSet<Integer>();
			for (InRoomCategoryLevel l : values()) {
				levels.add(l.getLevel());
			}
			return levels;
		}
		
	}

	public static enum PmsType {
		HOME,
		BUSINESS,
		;
	}

	public static enum ReservationStatus {
		DUE_IN("REVERSE_CHECKED_IN", "Due in", 1),
		DUE_OUT("REVERSE_CHECKED_OUT", "Due out", 2),
		RESERVED("RESERVED", "Reserved", 3),
		CHECKED_IN("CHECKED_IN", "Checked-in", 4),
		CHECKED_OUT("CHECKED_OUT", "Checked-out", 5),
		QUEUE("WAITLISTED", "Queue", 6),
		CANCELLED("CANCELLED", "Cancelled", 7),
		OTHER("OTHER", "Other", 8),
		;
		
		static Map<Long, ReservationStatus> statusMap = null;
		static List<Long> inRoomStatusList = null;
		
		static {
			inRoomStatusList = new ArrayList<Long>(2);
			inRoomStatusList.add(ReservationStatus.CHECKED_IN.getId());
			inRoomStatusList.add(ReservationStatus.DUE_OUT.getId());
		}
		
		String pmsStatus;
		String statusStr;
		long id;

		ReservationStatus(String pmsStatus, String statusStr, long id) {
			this.pmsStatus = pmsStatus;
			this.statusStr = statusStr;
			this.id = id;
		}

		public String getStatusStr() {
			return statusStr;
		}

		public String getPmsStatus() {
			return pmsStatus;
		}

		public long getId() {
			return id;
		}

		public static ReservationStatus getReservationStatus(long id) {
			if (statusMap == null) {
				ReservationStatus[] tempArray = ReservationStatus.values();
				statusMap = new HashMap<Long, ReservationStatus>(tempArray.length);
				for (ReservationStatus s : tempArray) {
					statusMap.put(s.id, s);
				}
			}
			return statusMap.get(id);
		}

		public static List<ReservationStatus> getStatusList() {
			return Arrays.asList(ReservationStatus.values());
		}

		public static List<Long> getInRoomStatusList() {
			return inRoomStatusList;
		}
	}

	public static enum GuestProfileType {
		IN_HOUSE_GUEST,
		NON_IN_HOUSE_GUEST,
		;
	}
	
	public static enum BookingStatus {
		WAITING_LIST,
		PENDING,
		BOOKED,
		CONFIRMED_BOOKING,
		COMPLETED,
		NO_SHOW,
		CANCEL,
		FAILED,
		;
	}
	
	public static enum BookingViewOrderBy {
		RESERVATION_DATE("reservation_date"), 
		;		
		private String column;
		private BookingViewOrderBy(String c) {
			column = c;
		}
		public String getColumn() {
			return column;
		}
	}

	public static enum RCStatus {
		NEW,
		NOTSYNC,
		COMPLETE
		;
	}

	public static enum FolioStatus {
		NEW,
		NOTSYNC,
		COMPLETE
		;
	}
	
	public static enum NotifyType{
		EMAIL,
		PHONE
		;
	}
	
	public static enum UpdateRCRequestType{
		EXPRESS_CHECKIN,
		SAVE
		;
	}

	public static enum EditableCategoryEnum {
		PERSONAL(new EditableFieldEnum[]{EditableFieldEnum.FIRST_NAME, EditableFieldEnum.LAST_NAME, EditableFieldEnum.TITLE, EditableFieldEnum.GENDER,
				EditableFieldEnum.NATIONALITY, EditableFieldEnum.LANGUAGE, EditableFieldEnum.NOTE, EditableFieldEnum.SPECIAL_CODES,
				EditableFieldEnum.EMAIL, EditableFieldEnum.MOBILE}),
		CONTACT(new EditableFieldEnum[]{EditableFieldEnum.HOME_OR_BUSINESS, EditableFieldEnum.ADDRESS, EditableFieldEnum.CITY, EditableFieldEnum.STATE,
				EditableFieldEnum.COUNTRY, EditableFieldEnum.POSTAL, EditableFieldEnum.PHONE}),
		RESERVATION(new EditableFieldEnum[]{EditableFieldEnum.NO_OF_GUEST, EditableFieldEnum.SHARE_RESERVATION, EditableFieldEnum.ARRIVAL_DATE,
				EditableFieldEnum.DEPART_DATE, EditableFieldEnum.ARRIVAL_TIME, EditableFieldEnum.DEPART_TIME, EditableFieldEnum.EXPRESS_CHECK_OUT,
				EditableFieldEnum.RC_REMARKS}),
		PAYMENT(new EditableFieldEnum[]{EditableFieldEnum.PAYMENT_COMMENT, EditableFieldEnum.PAYMENT_METHOD, EditableFieldEnum.DB_CODE}),
		;
		
		private List<EditableFieldEnum> fieldEnumList;

		private EditableCategoryEnum(EditableFieldEnum[] fields) {
			this.fieldEnumList = new ArrayList<EditableFieldEnum>();
			for (EditableFieldEnum ef : fields) {
				fieldEnumList.add(ef);
			}
		}

		public List<EditableFieldEnum> getFieldList() {
			return fieldEnumList;
		}
	}

	public static enum EditableFieldEnum {
		FIRST_NAME,
		LAST_NAME,
		TITLE,
		GENDER,
		NATIONALITY,
		LANGUAGE,
		NOTE,
		SPECIAL_CODES,
		HOME_OR_BUSINESS,
		EMAIL,
		MOBILE,
		ADDRESS,
		CITY,
		STATE,
		COUNTRY,
		POSTAL,
		PHONE,
		NO_OF_GUEST,
		SHARE_RESERVATION,
		ARRIVAL_DATE,
		DEPART_DATE,
		ARRIVAL_TIME,
		DEPART_TIME,
		EXPRESS_CHECK_OUT,
		RC_REMARKS,
		PAYMENT_COMMENT,
		PAYMENT_METHOD,
		DB_CODE,
		;
	}

	public static enum NotifType {
		CI_REQ,
		CI_TIMEOUT_ALERT,
		CO_REQ,
		CO_TIMEOUT_ALERT,
		BILL_NOTIF,
		;
	}

	public static enum NotifDestType {
		EMAIL(CommTypeEnum.EMAIL, CServiceCommonEnums.CommAdaptorEnum.EMAIL),
		PRINTER(CommTypeEnum.PRINTER, CServiceCommonEnums.CommAdaptorEnum.PRINTER),
		CCONNECT(CommTypeEnum.WEBSERVICE, CServiceCommonEnums.CommAdaptorEnum.CCONNECT),
		ECONNECT(CommTypeEnum.WEBSERVICE, CServiceCommonEnums.CommAdaptorEnum.ECONNECT),
		;
		
		private CommTypeEnum commType;
		private CServiceCommonEnums.CommAdaptorEnum commAdaptor;
		
		private NotifDestType(CommTypeEnum commType, CServiceCommonEnums.CommAdaptorEnum commAdaptor) {
			this.commType = commType;
			this.commAdaptor = commAdaptor;
		}

		public CommTypeEnum getCommTypeEnum() {
			return commType;
		}
		public String getCommType() {
			return commType == null ? null : commType.toString();
		}

		public CServiceCommonEnums.CommAdaptorEnum getCommAdaptorEnum() {
			return commAdaptor;
		}
		public String getCommAdaptor() {
			return commAdaptor == null ? null : commAdaptor.toString();
		}
	}

	public static enum TemplateType {
		CI_REQ,
		CI_TIMEOUT_ALERT,
		CO_AUTO_REQ,
		CO_MANU_REQ,
//		CO_SUC_ALERT,
		CO_TIMEOUT_ALERT,
		BILL_NOTIF,
		;
	}

	public static enum ExpressCheckoutType {
		MANU,
		AUTO,
		;
	}
	
	public static enum FileRequestType {
		REST_LOGO,
		REST_PHOTO,
		RC_INITIALS,
		RC_SIGNATURE,
		CATEGORY_ICON,
		CATEGORY_PHOTO,
		ITEM_ICON,
		ITEM_PHOTO,
		ITEM_PHOTO_SMALL,
		;
	}

	public static enum OrderStatus {
		PENDING,
		CANCELLED,
		COMPLETED,
		;
	}

	public static enum DelivLocationType {
		TO_ROOM,
		TO_LOCATION,
		;
	}

	public static enum ChargeType {
		SERVICE_CHARGE,
		DELIVERY_CHARGE,
		SALES_TAX,
		VAT,
		;
	}

	public static enum ChargeBy {
		PERCENTAGE,
		PERCENTAGE_COVER,
		FIXED,
		;
	}

	public static enum VersionEntityTypeEnum implements HasDisplayString {
		RESTAURANT("Restaurant"),
		CATEGORY("Category"),
		IN_ROOM_MENU("In-Room Dining Menu"),
		ITEM("Item"),
		COOK_OPTION("Cook Option"),
		SPICY("Spicy Description Icon"),
		MAIN_MENU("Main Menu"),
		THEME("Theme"),
		ADVERTISEMENT("Advertisement"),
		;

		private String displayStr;

		private VersionEntityTypeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}

	public static enum VersionTypeEnum implements HasDisplayString {
		EXPIRED ("Expired"),
		CURRENT("Current"),
		SCHEDULED("Scheduled"),
		TEMPLATE("Template"),
		OVERWRITTEN("Over-written");
		;

		private String displayStr;

		private VersionTypeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}
	
	public static enum StatusMessage{
		SUCCESS,
		FAILED,
		MISSING_REQUIRED_FIELD,
	    INVALID_FIELD,
		;
	}
	
	public static enum RestaurantConfigType{
		PRINTER,
		E_CONNECT,
		EMAIL,
		C_CONNECT,
		;
	}
	
	public static enum BookingRequestMsgTemp{
		DATE_TIME_OF_REQ_SENT,
		BOOKING_DATE_TIEM,
		GUEST_NAME,
		TITLE,
		RESTAURRANT_NAME,
		PAX,
		SMOKING_OPTIONAL,
		NOTES,
		CONTACT,
		;
	}

	public static enum RsvReqMsgEnum implements HasDisplayString {
		JOB_NO("Job No", "jobNo"),
		FIRST_NAME("First Name", "guestFirstName"),
		LAST_NAME("Last Name", "guestLastName"),
		ROOM_NO("Room No", "roomNumber"),
		CONF_NO("Confirmation No", "confirmationNo"),
		EXPECTED_ARRIVAL_TIME("Expected arrival time", "expectedarrivalTime"),
		PHONE("Phone", "phone"),
		EMAIL("Email", "email"),
		
		REQUEST_RECEIVE("Request Received Date & Time", "requestreceivedatetime"),
		ORDER_CHANGED("Order Changed", "orderchanged"),
		ORDER_CANCELLED("Order Cancelled", "ordercancelled"),
		ORDER_NO("Order No", "orderno"),
		TITE("Title", "title"),
		SURNAME("Surname", "surname"),
		ROOM("Room", "room"),
		DATE_TIME("Date & Time", "datetime"),
		ITEM("Item", "item"),
		QUATITY("Quatity", "quatity"),
		FROMLOCATION("From Location", "fromlocation"),
		TOLOCATION("To Location", "tolocation"),
		NOTE("Note", "note"),
		;

		private String displayStr;
		private String fieldName;
		
		private RsvReqMsgEnum(String displayStr, String fieldName) {
			this.displayStr = displayStr;
			this.fieldName = fieldName;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}

		public String getFieldName() {
			return fieldName;
		}
	}
	
	public static enum BookingComfirmTitleEnum{
		RESTAURANTNAME,
		;
	}
	
	public static enum BookingRequestMsgTitleTemp{
		NAME,
		;
	}

	public static enum CommTypeEnum {
		PRINTER,
		EMAIL,
		WEBSERVICE,
		;
	}

	public static enum BillOptionTypeEnum implements HasDisplayString {
		
		CHARGE_TO_ROOM("Charge To Room"),
		VISA_CARD("Visa Card"),
		MASTER_CARD("Master Card"),
		AMERICAN_EXPRESS("American Express"),
		CASH("American Express"),
		OTHER(""),
		;

		private String displayStr;
		
		private BillOptionTypeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}
	
	public static enum ChargeByTypeEnum implements HasDisplayString {
		
		PERCENTAGE("Percentage"),
		PER_INCL_SERV("Percentage include service charge"),
		FIXED("Fixed"),
		;

		private String displayStr;
		
		private ChargeByTypeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}
	
	public static enum ChargeCategoryTypeEnum implements HasDisplayString {
		
		SERVICE_CHARGE("Service Charge"),
		DELIVERY_CHARGE_PER_ITEM("Delivery Charge (Per Item)"),
		DELIVERY_CHARGE_PER_ORDER("Delivery Charge (Per Order)"),
		SALES_TAX("Sales Tax"),
		VAT("VAT"),
		;

		private String displayStr;
		
		private ChargeCategoryTypeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}
	
	public static enum ChargeRoundingTypeEnum implements HasDisplayString {
		
		UP("Up"),
		DOWN("Down"),
		ROUND_UP("Round up");
		;

		private String displayStr;
		
		private ChargeRoundingTypeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}

	public static enum ThemeItemType implements HasDisplayString {
		
		LOGO("LOGO"),
		TOP_BAR("Top Bar"),
		SEC_BAR("2nd Bar"),
		BODY("Body")
		;

		private String displayStr;
		
		private ThemeItemType(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}
	
	public static enum SmokingOrNotEnum{
		SMOKING,
		NON_SMOKING;
	}

	public static enum CommAdaptorEnum {
		PRINTER("printerAdaptor"),
		EMAIL("mailAdaptor"),
		CCONNECT("cConnectAdaptor"),
		ECONNECT("eConnectAdaptor"),
		;
	
		private String adaptorName;
	
		private CommAdaptorEnum(String adaptorName) {
			this.adaptorName = adaptorName;
		}
		
		public String getAdaptorName() {
			return adaptorName;
		}
	}

	public static enum ModuleEnum {
		RESERVATION(new VersionEntityTypeEnum[]{},
				new ResourceKeyEnum[]{ResourceKeyEnum.CI_SUC_MSG, ResourceKeyEnum.ECO_SUC_MSG}),
		RESTAURANT(new VersionEntityTypeEnum[]{VersionEntityTypeEnum.RESTAURANT},
				new ResourceKeyEnum[]{ResourceKeyEnum.BOOKING_REQ_ACK_POPUP}),
		IN_ROOM_DINING(new VersionEntityTypeEnum[]{VersionEntityTypeEnum.CATEGORY, VersionEntityTypeEnum.ITEM, VersionEntityTypeEnum.COOK_OPTION,
				VersionEntityTypeEnum.SPICY, VersionEntityTypeEnum.IN_ROOM_MENU},
				new ResourceKeyEnum[]{ResourceKeyEnum.OUT_OF_RSV_PERIOD_POPUP, ResourceKeyEnum.EXP_DELIV_TIME_POPUP,
				ResourceKeyEnum.NON_VALID_DELIV_TIME_POPUP, ResourceKeyEnum.ORDER_SEND_ACK_POPUP}),
		MAIN_MENU(new VersionEntityTypeEnum[]{VersionEntityTypeEnum.MAIN_MENU},
				new ResourceKeyEnum[]{}),
		THEME(new VersionEntityTypeEnum[]{VersionEntityTypeEnum.THEME},
				new ResourceKeyEnum[]{}),
		ADVERTISEMENT(new VersionEntityTypeEnum[]{VersionEntityTypeEnum.ADVERTISEMENT},
				new ResourceKeyEnum[]{}),
		;
		
		private List<VersionEntityTypeEnum> entityTypeList;
		private List<ResourceKeyEnum> resourceKeyList;

		private ModuleEnum(VersionEntityTypeEnum[] entityTypes, ResourceKeyEnum[] resourceKeys) {
			entityTypeList = new ArrayList<VersionEntityTypeEnum>();
			for (VersionEntityTypeEnum et : entityTypes) {
				entityTypeList.add(et);
			}
			resourceKeyList = new ArrayList<ResourceKeyEnum>();
			for (ResourceKeyEnum rt : resourceKeys) {
				resourceKeyList.add(rt);
			}
		}
		
		public List<VersionEntityTypeEnum> getEntityTypeList() {
			return entityTypeList;
		}
		
		public List<ResourceKeyEnum> getResourceKeyList() {
			return resourceKeyList;
		}
	}

	public static enum ResourceKeyEnum {
		CI_SUC_MSG,
		CI_FAIL_MSG,
		ECO_SUC_MSG,
		ECO_FAIL_MSG,
		OUT_OF_RSV_PERIOD_POPUP,
		EXP_DELIV_TIME_POPUP,
		NON_VALID_DELIV_TIME_POPUP,
		ORDER_SEND_ACK_POPUP,
		BOOKING_REQ_ACK_POPUP,
		;
	}

	public static enum PriceCategoryCodeEnum implements HasDisplayString {
		P1("P1"),
		P2("P2"),
		P3("P3"),
		;

		private String displayStr;

		private PriceCategoryCodeEnum(String displayStr) {
			this.displayStr = displayStr;
		}

		@Override
		public String getDisplayStr() {
			return displayStr;
		}
	}

	public static enum UpdateVerLevelEnum {
		ENT,
		ENT_TYPE,
		ENT_TYPE_MOD,
		TYPE,
		TYPE_MOD,
		MOD,
	}
	
	public static enum iGuestHouseKeepingType{
		PRINTER,
		E_CONNECT,
		EMAIL,
		C_CONNECT,
		;
	}
	
	public static enum cConnectRequestActionType implements HasDisplayString{
		WAITING_LIST,
		PENDING,
		BOOKED,
		CONFIRMED_BOOKING,
		COMPLETED,
		NO_SHOW,
		CANCEL,
		FAILED,
		;

		@Override
		public String getDisplayStr() {
			// TODO Auto-generated method stub
			return null;
		}
	}
}
